package com.zy.batiya.util;

import java.util.Map;
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;

import org.apache.shiro.subject.PrincipalCollection;
import org.springframework.stereotype.Component;

/**
 * 存储shiro已登录用户
 * 使用抽象类，避免在使用时使用new做无用操作
 * */
public abstract class PrincipalCollectionPool {

	private static Map<String,PrincipalCollection> pool = new ConcurrentHashMap<String,PrincipalCollection>();
	
	public static PrincipalCollection getPrincipalCollection(String username){
		return pool.get(username);
	}
	
	public static void setPrincipalCollection(String uname,PrincipalCollection value){
		pool.put(uname, value);
	}
}
